package com.example.administrator.managesystem.fragment.firstpage;
import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.Toast;
import com.example.administrator.managesystem.R;
import com.example.administrator.managesystem.adapter.NormalRecyclerViewAdapter;
import com.example.administrator.managesystem.base.BaseFragment;
import com.example.administrator.managesystem.utils.ToastUtils;
import java.util.ArrayList;
import java.util.List;

public class OrderMessageFragment extends BaseFragment implements SwipeRefreshLayout.OnRefreshListener{
    private RecyclerView recyclerView;
    private NormalRecyclerViewAdapter adapter;
    private List<String> message = new ArrayList<>();


    @Override
    public void doBusiness() {
        adapter=new NormalRecyclerViewAdapter(getActivity());
        recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
        recyclerView.setAdapter(adapter);
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        adapter.addListener(new NormalRecyclerViewAdapter.IonSlidingViewClickListener() {
            @Override
            public void onItemClick(View view, int position) {
                ToastUtils.showToast(getActivity(),"点了"+position,Toast.LENGTH_SHORT);
            }

            @Override
            public void onDeleteBtnClick(View view, int position) {
                adapter.removeData(position);
            }
        });

    }


    @Override
    protected void initView(View view, Bundle savedInstanceState) {

        recyclerView=view.findViewById(R.id.order_message_recycler);
        message.add("1");
        message.add("2");
        message.add("3");
        message.add("4");
    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_order_list;
    }

    @Override
    public void onRefresh() {

    }

}
